package com.frxuexi.mdm2204.myview

import android.content.Context
import android.graphics.Canvas
import android.graphics.Color
import android.graphics.Paint
import android.util.AttributeSet
import androidx.appcompat.widget.AppCompatTextView

class MyView:AppCompatTextView {
    lateinit var paint: Paint
    constructor(context: Context) : super(context){
        paint= Paint()
        paint.color=Color.BLUE
        paint.textSize=30F
    }
    constructor(context: Context, attrs: AttributeSet?) : super(context, attrs){
        paint= Paint()
        paint.color=Color.BLUE
        paint.textSize=30F
    }

    override fun onDraw(canvas: Canvas) {
        super.onDraw(canvas)
        canvas.drawText("哈喽",200f,300f,paint)
        canvas.drawLine(100f,100f,300f,300f,paint)
        canvas.drawArc(200f,300f,300f,400f,100f,200f,true,paint)
        canvas.drawCircle(300f,600f,100f,paint)
        canvas.drawRect(300f,200f,800f,600f,paint)
    }
}